<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateModelFieldTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('model_field', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('model_id')->comment('关联模型ID');
            $table->string('name')->comment('字段名');
            $table->string('type')->comment('字段类型');
            $table->string('default_value')->comment('字段默认值')->nullable();
            $table->string('comment')->comment('字段注释');
            $table->string('form_name',50)->comment('表单名称');
            $table->string('form_type')->comment('表单类型');
            $table->string('form_comment')->comment('表单备注')->nullable();
            $table->string('form_params')->comment('表单参数')->nullable();
            $table->string('form_default')->comment('表单默认值')->nullable();
            $table->tinyInteger('is_show')->comment('是否显示')->default(0);
            $table->tinyInteger('is_required')->comment('是否必填')->default(0);
            $table->tinyInteger('is_table_title')->comment('是否表格Title')->default(0);
            $table->Integer('order')->comment('排序')->default(1);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('model_field');
    }
}
